﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GLSimulationControl;
using MySafeLib;

namespace _3CMillingSimulator
{
    public partial class ToolCreate : Form
    {
        public ToolCreate()
        {
            InitializeComponent();
        }

        private void cancelSphericalButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void SetToolsOrigin(MaterialControl mc)
        {
        }

        private void createSphericalButton_Click(object sender, EventArgs e)
        {
            double length = 0.0;
            SafeStringParser<double> lengthParser = new SafeStringParser<double>();
            lengthParser.Parse( this.totalLengthBallMillTextBox.Text, ref length );

            int diameter = 0;
            SafeStringParser<int> diameterParser = new SafeStringParser<int>();
            diameterParser.Parse( this.diameterBallMillToolTextBox.Text, ref diameter );

            SimulatorControlGL.CreateBallMillTool( length, diameter );
            this.Close();
        }

        private void cancelToroidalButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void createToroidalToolButton_Click(object sender, EventArgs e)
        {
            double length = double.Parse( this.totalLengthToroidalToolTextBox.Text );
            int diameter = int.Parse( this.diameterToroidalToolTextBox.Text );
            SimulatorControlGL.CreateToroidalTool( length, diameter );
            this.Close();
        }
    }
}
